package com.example.yeujian5.yuejian5.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import com.example.yeujian5.yuejian5.fragment.QuestionFragment;
import com.example.yeujian5.yuejian5.fragment.VideoFragment;

import java.util.List;

/**
 * Created by wangmengmeng on 2017/10/24.
 */

public class MasterDetailAdapter extends FragmentPagerAdapter{
    private String[] mTitles = new String[]{"大师课堂", "我的提问"};
    private List<Fragment> fragments;
    public MasterDetailAdapter(FragmentManager supportFragmentManager,List<Fragment> fragments) {
        super(supportFragmentManager);
        this.fragments=fragments;
    }

    public MasterDetailAdapter(FragmentManager supportFragmentManager) {
        super(supportFragmentManager);
    }

    @Override
    public Fragment getItem(int position) {
        if (position==0){
            return new VideoFragment();
        }
        return new QuestionFragment();
    }


    @Override
    public int getCount() {
        return mTitles.length;
    }
    @Override
    public CharSequence getPageTitle(int i) {
        return mTitles[i];
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        return super.instantiateItem(container, position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        super.destroyItem(container, position, object);
    }
}
